﻿Public Class frmTKNhanVien

    Private Sub frmTKNhanVien_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dgvDSNhanVien.DataSource = CKiemTra.LoadDS("select * from NHANVIEN")
        cbxPhai.SelectedIndex = 0
    End Sub

    Private Sub btnTimKiem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimKiem.Click
        If txtTenNhanVien.Text <> "" Then
            Dim sql = "select * from NHANVIEN where TenNhanVien like N'%" + txtTenNhanVien.Text + "%' and GioiTinh = '" + cbxPhai.Text + "'"
            dgvDSNhanVien.DataSource = CKiemTra.LoadDS(sql)
        End If
        
    End Sub

    Private Sub cbxPhai_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxPhai.SelectedIndexChanged
        dgvDSNhanVien.DataSource = CKiemTra.LoadDS("select * from NHANVIEN where GioiTinh = N'" + cbxPhai.Text + "'")
    End Sub
End Class